feat: 알림 구독 정보 API#90
Conversation
|
Warning Review limit reached
Next review available in: 43 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughChangesUser account operations
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant UserController
participant UserService
participant User
Client->>UserController: POST /me/push-subscription with PushSubscriptionRequest
UserController->>UserService: registerPushSubscription(userId, request)
UserService->>User: updatePushSubscription(endpoint, keys)
UserService-->>UserController: successful registration
UserController-->>Client: success response
Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/java/com/leets/tdd/user/service/UserService.java (1)
227-273: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider consolidating
hasOngoingDeliveryParty/hasUnsettledDeliveryParty.Both methods repeat the same "check creator → return true if found → skip if no joined parties → check joined ids" shape, differing only in which repository calls they delegate to. Extracting a shared helper reduces duplication as more withdrawal restrictions get added later.
♻️ Proposed refactor
+ private boolean existsAsCreatorOrParticipant( + List<Long> joinedPartyIds, BooleanSupplier creatorCheck, BooleanSupplier participantCheck) { + if (creatorCheck.getAsBoolean()) { + return true; + } + return !joinedPartyIds.isEmpty() && participantCheck.getAsBoolean(); + } + private boolean hasOngoingDeliveryParty(Long userId, List<Long> joinedPartyIds) { - if (deliveryPartyRepository.existsByCreatorIdAndStatusIn(userId, ONGOING_PARTY_STATUSES)) { - return true; - } - if (joinedPartyIds.isEmpty()) { - return false; - } - return deliveryPartyRepository.existsByIdInAndStatusIn(joinedPartyIds, ONGOING_PARTY_STATUSES); + return existsAsCreatorOrParticipant(joinedPartyIds, + () -> deliveryPartyRepository.existsByCreatorIdAndStatusIn(userId, ONGOING_PARTY_STATUSES), + () -> deliveryPartyRepository.existsByIdInAndStatusIn(joinedPartyIds, ONGOING_PARTY_STATUSES)); } private boolean hasUnsettledDeliveryParty(Long userId, List<Long> joinedPartyIds) { - if (deliveryPartyRepository.existsByCreatorIdAndStatusAndSettlementStatusNotIn( - userId, PartyStatus.COMPLETED, SETTLEMENT_TERMINAL_STATUSES)) { - return true; - } - if (joinedPartyIds.isEmpty()) { - return false; - } - return deliveryPartyRepository.existsByIdInAndStatusAndSettlementStatusNotIn( - joinedPartyIds, PartyStatus.COMPLETED, SETTLEMENT_TERMINAL_STATUSES); + return existsAsCreatorOrParticipant(joinedPartyIds, + () -> deliveryPartyRepository.existsByCreatorIdAndStatusAndSettlementStatusNotIn( + userId, PartyStatus.COMPLETED, SETTLEMENT_TERMINAL_STATUSES), + () -> deliveryPartyRepository.existsByIdInAndStatusAndSettlementStatusNotIn( + joinedPartyIds, PartyStatus.COMPLETED, SETTLEMENT_TERMINAL_STATUSES)); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/com/leets/tdd/user/service/UserService.java` around lines 227 - 273, Consolidate the duplicated creator-and-participant lookup flow in hasOngoingDeliveryParty and hasUnsettledDeliveryParty by extracting a shared helper that accepts the relevant repository checks or predicates. Preserve the current short-circuit behavior, including returning false when joinedPartyIds is empty, and keep each method’s existing status and settlement criteria unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/main/java/com/leets/tdd/user/service/UserService.java`:
- Around line 227-273: Consolidate the duplicated creator-and-participant lookup
flow in hasOngoingDeliveryParty and hasUnsettledDeliveryParty by extracting a
shared helper that accepts the relevant repository checks or predicates.
Preserve the current short-circuit behavior, including returning false when
joinedPartyIds is empty, and keep each method’s existing status and settlement
criteria unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 1b8a36a2-3661-4fd5-a4ee-955d8a2551bc
📒 Files selected for processing (9)
src/main/java/com/leets/tdd/party/repository/DeliveryPartyRepository.javasrc/main/java/com/leets/tdd/party/repository/PartyParticipantRepository.javasrc/main/java/com/leets/tdd/user/controller/UserController.javasrc/main/java/com/leets/tdd/user/domain/User.javasrc/main/java/com/leets/tdd/user/dto/PushSubscriptionRequest.javasrc/main/java/com/leets/tdd/user/exception/UserErrorCode.javasrc/main/java/com/leets/tdd/user/service/UserService.javasrc/test/java/com/leets/tdd/user/controller/UserControllerTest.javasrc/test/java/com/leets/tdd/user/service/UserServiceTest.java
작업 내용
변경 사항
리뷰 포인트
체크리스트
Summary by CodeRabbit
New Features
Validation